    //
//  StarViewHolder.m
//  TestingApp
//
//  Created by Amit Priyadarshi on 05/11/11.
//  Copyright 2011 Dbydx. All rights reserved.
//

#import "StarViewHolder.h"
#import "DdxRatingControl.h"


@implementation StarViewHolder
// The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
/*
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization.
    }
    return self;
}
*/

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/
- (void)animate {
}
- (void)finished {
//	UIAlertView* al = [[[UIAlertView alloc] initWithTitle:@"Stoped" message:nil delegate:nil cancelButtonTitle:@"Waooo!" otherButtonTitles:nil] autorelease];
//	[al show];
	NSLog(@"%s",__FUNCTION__);
}

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
	DdxRatingControl* t = [[DdxRatingControl alloc] initWithFrame:CGRectMake(20, 50, 100, 35)];
	t.numberOfStars = 3;
	[t setSelectedFillColor:[UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.99]];
	[t setSelectedBorderColor:[UIColor colorWithRed:0.55 green:0.0 blue:0.0 alpha:0.99]];
	[t addTarget:self action:@selector(finished) forControlEvents:UIControlEventTouchUpInside];
	[self.view addSubview:t];
	
	
	t = [[DdxRatingControl alloc] initWithFrame:CGRectMake(20, 150, 100, 35)];
	t.numberOfStars = 5;
	[t setSelectedFillColor:[UIColor colorWithRed:0.85 green:0.0 blue:0.0 alpha:0.92]];
	[t setSelectedBorderColor:[UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.99]];
	[t addTarget:self action:@selector(finished) forControlEvents:UIControlEventTouchUpInside];
	[self.view addSubview:t];
	[t setRating:3];
	
	t = [[DdxRatingControl alloc] initWithFrame:CGRectMake(20, 250, 100, 35)];
	t.numberOfStars = 7;
	[t addTarget:self action:@selector(finished) forControlEvents:UIControlEventTouchUpInside];
	[self.view addSubview:t];
}
- (void)addAsFavorite {
	UIAlertView* al = [[[UIAlertView alloc] initWithTitle:@"Working" message:nil delegate:nil cancelButtonTitle:@"Waooo!" otherButtonTitles:nil] autorelease];
	[al show];	
}
- (void)viewWillAppear:(BOOL)animated {
	
//	DdxStarView* sv = [[[DdxStarView alloc] initWithFrame:CGRectMake(200, 200, 30, 30)] autorelease];
//	[self.view addSubview:sv];
//	[sv addTarget:self action:@selector(addAsFavorite) forControlEvents:UIControlEventTouchUpInside];
}

/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc. that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end
